package com.sunnyatwal.kettlebell.db;

import java.io.IOException;

import android.content.Context;

import com.sunnyatwal.kettlebell.model.Exercise;

public class WorkoutDatabaseSingleton {

	private static WorkoutDatabase mDatabase = null;
	private static final String mDirectory = "data";
	private static final String mFile = "kettlebell.db4o";
	
	
	public static WorkoutDatabase getDatabase(Context c) throws IOException {
		
		if (mDatabase == null) {
			
			String path = Database.buildPath(c, mDirectory, mFile);			
			mDatabase = new WorkoutDatabase(Exercise.class, path);			
		}
		
		mDatabase.open();
		
		return mDatabase;
	}
	
	
}
